1. Field of the Invention
The present invention relates to a method for compressing an image having a multiplicity of levels of gradations for use in a printers a copying machine or the like.
2. Description of the Related Art
In recent years, a market for output devices such as printers, copying machines and so on has been growing significantly. These devices have been required to have a high quality of output and needs for their color image output has been recently increased. To this end, the data processing performed by such devices inevitably involves an increase in the necessary capacity of memory and thus it becomes expensive. Meanwhile, in the current situations, less price competition of such devices per se has been accelerated. For the purpose of realizing a high quality of output with less price, it is necessary to reduce the necessary capacity of memory based on the compression technique of image data.
Conventional methods for compressing information on a gray-scale image include a technique called block approximation coding. This method will be explained by referring to FIGS. 1 to 7.
FIG. 1 shows a partly enlarged image, in which reference numeral 1 denotes a picture element or pixel as a minimum unit of the image. It is assumed in this case that one pixel is made up of 8 bit data indicative of 256 gradations having values of 0 to 256. Adjacent pixels in a 4.times.4 array (a total of 16 pixels) form a block 2. Data processing is carried out on a block basis.
FIG. 2 shows a practical example of the block 2, and FIG. 3 shows a procedure when the block 2 is subjected to a block approximation coding. Firsts an average value X of the pixels of the block 2 (in-block average value) to be subjected to the block approximation coding is found (step 1). In the examples the in-block average value X of FIG. 2 is 121.9.
Then the in-block average value is compared with the respective values of the pixels in the block 2 to divide the pixels into a group in which pixels have values smaller than the in-block average value and a group in which pixels have values larger than the in-block average value (step 2). The pixels belonging to a group having a value less than the in-block average value are set to be represented by "0", and the pixels belonging to a group having a value not less than the in-block average value are set to be represented by "1" to thereby form a pixel array pattern. A pixel array pattern (bit map data) corresponding to the block 2 of FIG. 2 is shown in FIG. 4.
Next, an average value X0 of the values of the pixels represented by "0" in the pixel array pattern and an average value X1 of the values of the pixels represented by "1" in the pixel array pattern are calculated respectively to be used as representative values of the block (step 3). In the case of the block 2 of FIG. 2, the representative values X0 and X1 of the block are 34 (22 h) and 161 (a1 h) respectively. A final block code 4 of the block 2 is made up of 2 representative values of each 8 bits and a single pixel array pattern of 16 bits as shown in FIG. 5A, which specific example is as shown in FIG. 5B.
Shown in FIG. 6 is an expanding procedure of restoring the block code 4 to practical image data. More in detail, such operations (step 4) that the block representative value X0 in the block code 4 of FIG. 5A or 5B is applied to the pixels represented by "0" while the block representative value X1 thereof is applied to the pixels represented by "1" are carried out for all the pixels within the block. An image is obtained as a result of expanding the block code 4 of FIG. 5A or 5B.
In general, when one pixel is represented by q bit data and one block has N pixels, the quantity of data on one of blocks of an original image is q.times.N bits and image data after block coding is 2q+N bits corresponding to a sum of N bits of pixel array pattern and 2.times.q bits of block representative values.
Accordingly, a compression ratio of the image data based on the block coding is qN/(2q+N). In the example of FIG. 2, its compression ratio becomes 4 because one pixel is represented by 8 bits and one block has 16 bits.
However, a higher compression ratio has been demanded. It is an object of the present invention to provide an image compression system which enables data transmission with a memory smaller in capacity than a memory necessary for a prior art block approximation coding.